
public class DebitCard extends Card 
{	/**
	 * creates a basic debit card with no account tied to it.
	 * @param name the card owner's name
	 * @param street the card owner's street
	 * @param town the card owner's town
	 * @param zipCode the card owner's town zip code
	 * @param country the card owner's country
	 */
	public DebitCard(String name, String street, String town, String zipCode, String country)
	{
		fName = name;
		fStreet = street;
		fTown = town;
		fCountry = country;
	}
	/**
	 * creates a debit card with an account tied to it.
	 * @param name the card owner's name
	 * @param street the card owner's street
	 * @param town the card owner's town
	 * @param zipCode the card owner's town zip code
	 * @param country the card owner's country
	 * @param account the account connected to this debit card
	 */
	public DebitCard(String name, String street, String town, String zipCode, String country, CheckingAccount account)
	{
		fName = name;
		fStreet = street;
		fTown = town;		
		fCountry = country;
		fAccountConnectedTo = account;
	}
	/**
	 * method that sees if you can pay for an item
	 * if you can decreases the current balance
	 * @param amount the amount of the item
	 * @return true if you can purchase false otherwise
	 */
	public boolean pay(double amount)
	{
		if((fAccountConnectedTo.getBalance() - amount) >= -fAccountConnectedTo.getDebitAmount())
		{
			fAccountConnectedTo.setBalance(fAccountConnectedTo.getBalance() - amount);
			return true;
		}
		else
		{
			return false;
		}
	}

}
